package com.gl.emms.whale.db;


import com.gl.emms.whale.util.ApplacationInfo;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper {

	public DBHelper(Context context) {
		super(context, ApplacationInfo.DBNAME, null, 1);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("CREATE table IF NOT EXISTS User"
				+ " (_id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT, password TEXT, phonenum TEXT, firstroom TEXT, firstcardnum TEXT,roomcnt INTEGER,lastlogtime TEXT,ipport TEXT)");
		//db.execSQL("CREATE table IF NOT EXISTS SystemSettings"
		//		+ " (_id INTEGER PRIMARY KEY AUTOINCREMENT, logintimes INTEGER, version TEXT, lastversion TEXT)");
		db.execSQL("CREATE table IF NOT EXISTS RoomInfo"
				+ " (_id INTEGER PRIMARY KEY AUTOINCREMENT, roomname TEXT, cardnum TEXT, jzqdz TEXT,qyglqdz TEXT,qyglqdz TEXT,zddz TEXT,pn TEXT,sn TEXT,fmkzcnt TEXT)");
		db.execSQL("CREATE table IF NOT EXISTS RoomData"
				+ " (_id INTEGER PRIMARY KEY AUTOINCREMENT, roomname TEXT, haserr TEXT, ye TEXT,bjsz TEXT,bds TEXT,qzfmzt TEXT,fmzt TEXT,zje TEXT,jswd TEXT,hswd TEXT,ls TEXT,dbye TEXT,dbsydl TEXT,sbysl TEXT)");
		db.execSQL("CREATE table IF NOT EXISTS SystemMsg"
				+ " (_id INTEGER PRIMARY KEY AUTOINCREMENT, msgtitle TEXT, senddate TEXT, msgfrom TEXT,message TEXT,isreaded TEXT,img TEXT)");
	
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("ALTER TABLE user ADD COLUMN other TEXT");
	}

}
